package com.github.xuchen93.forlaozeng.opreate_3;

import java.util.Scanner;

/**
 * @author xuchen.wang
 */
public class Subject_1 {

	private static final double pi = 3.1415;

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("选择图形类型：");
		System.out.println("1.矩形");
		System.out.println("2.直角三角形");
		System.out.println("3.圆形");
		int i = scanner.nextInt();
		switch (i){
			case 1:
				System.out.println("请输入矩形长：");
				int l = scanner.nextInt();
				System.out.println("请输入矩形宽：");
				int d = scanner.nextInt();
				System.out.println("area："+l*d);
				break;
			case 2:
				System.out.println("请输入直角三角形长边：");
				int ll = scanner.nextInt();
				System.out.println("请输入直角三角形短边：");
				int dd = scanner.nextInt();
				System.out.println("area："+ll*dd/2);
				break;
			case 3:
				System.out.println("请输入圆形半径：");
				int r = scanner.nextInt();
				System.out.println("area："+r*r*pi);
				break;
		}
	}
}
